<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr = ["red", "green", "blue", "pink"];
      // 方法一
      // var newArr = arr.reverse();
      // 方法二
      // var newArr = [];
      // for (var i = arr.length - 1; i >= 0; i--) {
      //   newArr.push(arr[i]);
      // }
      // console.log(newArr);
      // 方法三
      var newArr = [];
      arr.forEach((item) => {
        newArr.unshift(item);
      });

      console.log(newArr);
    </script>
  </body>
</html>
